package com.atguigu.srb.base.listener;

import java.util.EventListener;
import java.util.EventObject;

public class AnimalListener implements EventListener {
    public void eatEventHandler(EventObject eventObject) {
        // 从事件中获取事件源
        Animal source = (Animal) eventObject.getSource();
        System.out.println("1 获取事件源 " + source.getName() + " 1");
//        try {
//            // 打印事件源的名称
//            Thread.sleep(5000);
//            System.out.println("listener: Get event —— " + source.getName() + " is eating!");
//        }catch (Exception e){
//            System.out.println(1);
//        }
    }
}
